package com.lry;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.nio.ByteBuffer;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SelectMappedBufferResult {

    private long startOffset;

    private ByteBuffer byteBuffer;

    private int size;

    private MappedFile mappedFile;

    public synchronized void release() {
        if (this.mappedFile != null) {
            this.mappedFile.release();
            this.mappedFile = null;
        }
    }
}
